<?php
$content = file_get_contents('http://www.webmaster-toolkit.com/mime-types.shtml');

preg_match_all('#<tr class="tablerow.*">(.*)</tr>#isU', $content, $matches);

$js = "";

$lastExt = '';
$table = '';

for($i = 0; $i < count($matches[1]); $i++) {
	if(preg_match('#<td.*>(.*)</td>.*<td.*>(.*)</td>#isU', $matches[1][$i], $match)) {
		$ext = substr($match[1], 1, strlen($match[1]) - 1);
		
		if($ext != $lastExt) {
			$js .= "case '" . $lastExt . "':\n";
			$js .= "\treturn [" . substr($table, 0, strlen($table) - 2) . "];\n";
			$js .= "break;\n";

			$table = '';
			$lastExt = $ext;
		}
		
		$table .=  "'" . $match[2] . "', ";
		
	} else {
		exit($matches[1][$i]);
	}
}

echo $js;
?>